const db = wx.cloud.database()
Page({
  data: {

  },
  //  //生命周期函数--监听页面加载
  onLoad: function (options) {
    db.collection('OrederTask').where({
    }).get().then((res) => {
    
    })
  },
  //获取用户openid(云函数调用)
  getopenid: function () {
    wx.cloud.callFunction({
      name: "openid",
    }).then(res => {
      var openid = res.result.event.userInfo.openId
      console.log('获取成功', openid)
      this.data.openID = openid
    }).catch(res => {
      console.log('获取失败', res)
    })
  },
  //获取用户授权(云函数调用)
  getInfo() {
    wx.requestSubscribeMessage({
      tmplIds: ['pPR8B6TAfsR3hGewWrexY8wVPZwzykuw5C671OYX0Ks'],
      success(res) {
        console.log('授权成功')
      },
      fail(res) {
        console.log('授权失败')
      }
    })
  },
  //发送订阅消息(云函数调用)
  sendInfo: function () {
    wx.cloud.callFunction({
      name: "send",
      data: {
        openid: 'ohvNA5eVsPcQokGBeZCQSnijwNeQ'
      },
    }).then(res => {
      console.log('发送成功', res)
    }).catch(res => {
      console.log('发送失败', res)
    })
  },
})